class Machine < ActiveRecord::Base

    self.per_page = 35
    belongs_to :room #cl� �trang�re -room_id
    has_many :incidents
    validates_uniqueness_of :machine_name, :message => "is already exist in the parc"
    validates_uniqueness_of :serial_number, :message => "could not have twice serial number"
    #validates_uniqueness_of :ip_adr, :message => "could not have twice ip address"
  
    validates_format_of :ip_adr, :with => /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/i,
    :message => "This is not an ip v4 valid"
    validates_presence_of :room_id, :message => "You need to choose a room", :allow_nil => false

end
